<template>
  <div>
    <component :is="currentComponent" @add="add" @edit="edit" @audit="audit" :addInfo="addInfo" :editInfo="editInfo"   @handleCancel="handleCancel" ref="childComponent" />
  </div>
</template>

<script>
import List from "./list"
import AddPmsPurchaseRequisitions from "./addPmsPurchaseRequisitions"
import EditPmsPurchaseRequisitions from "./editPmsPurchaseRequisitions"
import AuditPmsPurchaseRequisitions from "./auditPmsPurchaseRequisitions"

export default {
  name: "Index",
  components: {List,AddPmsPurchaseRequisitions,EditPmsPurchaseRequisitions,AuditPmsPurchaseRequisitions},
  data() {
    return {
      currentComponent:"List",
      addInfo:{},
      editInfo:{}
    }
  },
  created() {
  },
  methods: {
    add(data){
      this.addInfo = data;
      this.currentComponent = "AddPmsPurchaseRequisitions";
    },
    edit(data){
      this.editInfo = data;
      this.currentComponent = "EditPmsPurchaseRequisitions";
    },
    audit(data){
      this.editInfo = data;
      this.currentComponent = "AuditPmsPurchaseRequisitions";
    },

    handleCancel(){
      this.currentComponent = "List"
    }
  }
}
</script>
<style>

</style>
